package com.lc.demo.service.impl;

import com.lc.demo.bean.Goods;
import com.lc.demo.mapper.GoodsMapper;
import com.lc.demo.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: sakila
 * @Date: 2022/03/06/23:25
 * @Description:
 */
@Service
public class GoodsServiceImpl  implements GoodsService {


    @Autowired
    private GoodsMapper goodsMapper;


    @Override
    public List<Goods> selectGoodsList(Integer sales, Integer newtime) {

        if (sales!=null){
            return  goodsMapper.selectAllOrderbySales();
        }
        if (newtime!=null){
            return  goodsMapper.selectAllOrderbyTime();
        }

        return goodsMapper.selectAll();
    }

    @Override
    public Goods selectGoodsByGoodsId(Integer goodsId) {
        return goodsMapper.selectByPrimaryKey(goodsId);
    }
}
